//
//  DateUtil.m
//  WE
//
//  Created by iMacOne on 15/12/3.
//  Copyright © 2015年 UNOHACHA. All rights reserved.
//

#import "DateUtil.h"
#define DATE_TIME_FORMAT @"yyyy-MM-dd HH:mm:ss"
#define DATE_TIME_FORMAT_JIE @"yyyy-MM-dd HH:mm"
#define DATE_FORMAT @"yyyy-MM-dd"
#define TIME_FORMAT @"HH:mm:ss"
#define DATE_NO_FORMAT @"yyyyMMddHHmmss"
#define DATE_YEAR @"yyyy"
#define DATE_MONTH @"MM"
#define DAY_SECONDS 86400

@implementation DateUtil

+ (NSDateFormatter*)formatDate:(NSString *)fomate {
    NSDateFormatter *format = [[NSDateFormatter alloc] init];
    [format setDateFormat:fomate];
    return format;
}
+ (NSDate *)getDate:(NSString *)str
{
    NSDateFormatter * formate = [[NSDateFormatter alloc] init];
    [formate setDateFormat:DATE_FORMAT];
    return [formate dateFromString:str];
}
+ (NSString *)getString:(NSDate *)date :(NSString *)str
{
    return (nil != date ? [[DateUtil formatDate:str] stringFromDate:date] : @"");
}
@end
